package com.jdrx.sw.sewage.service;

import com.jdrx.sw.sewage.beans.entity.CategoryPO;
import com.jdrx.sw.sewage.beans.vo.CategoryVO;
import com.jdrx.sw.sewage.dao.CategoryDAO;
import com.jdrx.sw.sewage.service.base.BaseServiceImpl;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CategoryServiceImpl extends BaseServiceImpl {

    public static final Logger logger = LoggerFactory.getLogger(CategoryServiceImpl.class);

    @Autowired
    private CategoryDAO CategoryDAO;

    public List<CategoryPO> selectNameList(Long materielId) {
        return CategoryDAO.selectNameList(materielId);
    }

    public List<CategoryPO> selectList(Long materielId) {
        return CategoryDAO.selectList(materielId);
    }

    public void add(CategoryVO categoryVO) {
        CategoryPO categoryPO = new CategoryPO();
        BeanUtils.copyProperties(categoryVO, categoryPO);
        CategoryDAO.insert(categoryPO);
    }
}
